<?php echo $this->Form->create('Post', array('type' => 'file')); ?>
<?php
echo $this->Session->flash();
echo $this->Session->flash('good');
echo $this->Session->flash('bad');
echo $this->Form->input('id');
?>
<table class="form-table">
    <tr>
        <td class='l-style'><?php echo __('Category') ?></td>
        <td class="r-style width_middle"><?php echo $this->Form->input('category_id', array('label' => false, 'escape' => false)); ?></td>
    </tr>
    <tr>
        <td class='l-style'><?php echo __('Title') ?><span class='star-rq'> * </span></td>
        <td class="r-style width_middle"><?php echo $this->Form->input('title', array('label' => false, 'class' => 'required title-slug')); ?></td>
    </tr>
    <tr>
        <td class='l-style'><?php echo __('Description') ?><span class='star-rq'> * </span></td>
        <td class="r-style width_full"><?php echo $this->Form->input('description', array('label' => false, 'class' => 'required', 'cols' => 30, 'rows' => 4)); ?></td>
    </tr>
    <tr>
        <td class='l-style'><?php echo __('Content') ?><span class='star-rq'> * </span></td>
        <td class="r-style width_full"><?php echo $this->Form->input('content', array('label' => false, 'class' => 'required mceEditor')); ?></td>
    </tr>
    <tr>
        <td class='l-style'><?php echo __('Image') ?></td>
        <td class="r-style width_middle">
            <?php
            echo $this->Form->input('image', array('type' => 'file', 'label' => false));
            echo $this->Form->input('dir', array('type' => 'hidden'));
            echo $this->Form->input('mimetype', array('type' => 'hidden'));
            echo $this->Form->input('filesize', array('type' => 'hidden'));
            ?>
            <?php if (isset($this->request->data['Post']['id'])): ?>
                <?php echo $this->Posts->thumbSmall($this->request->data); ?>
            <?php endif; ?>
        </td>
    </tr>
    <tr>
        <td class='l-style'><?php echo __('Tags') ?></td>
        <td class="r-style width_middle"><?php echo $this->Form->input('tags', array('label' => false)); ?></td>
    </tr>
    <tr>
        <td class='l-style'><?php echo __('SEO Title') ?></td>
        <td class="r-style width_middle"><?php echo $this->Form->input('slug', array('label' => false, 'class' => 'required slug-string')); ?></td>
    </tr>
    <tr>
        <td class='l-style'><?php echo __('Meta Keywords') ?></td>
        <td class="r-style width_middle"><?php echo $this->Form->input('meta_keywords', array('label' => false, 'class' => 'required')); ?></td>
    </tr>
    <tr>
        <td class='l-style'>
            <?php echo __('Meta Descriptions') ?> </br>
            <span class="span-note"><?php echo __('Suggest 160 characters') ?></span>
        </td>
        <td class="r-style width_full">
            <?php echo $this->Form->input('meta_description', array('label' => false, 'class' => 'required', 'onKeyUp' => "count_character(this);", 'cols' => 30, 'rows' => 3)); ?>
            <p> <input type="text" id="count_chars" style="width: 40px !important; height: 20px; text-align:center;" disabled value="0" class="square-ipt" /> <?php echo __('words') ?></p>
        </td>
    </tr>
    <tr>
        <td class='l-style'><?php echo __('Publish') ?></td>
        <td class="r-style width_middle">
            <?php echo $this->Form->radio("status", array(Post::publish => __('Publish'), 
																													Post::draf => __('Draf')), 
																													array('legend' => false, 'default' => Post::draf)); ?>
        </td>
    </tr>
		<tr>
        <td class='l-style'><?php echo __('Publish Date') ?></td>
        <td class="r-style width_middle">
					<?php echo $this->Form->input('schedule_public_date', array('label' => false, 'class' =>'datetime-select' ,'dateFormat' => 'DMY', 
																																		   'minYear' => date('Y') - 1,
																																		   'maxYear' => date('Y') + 1)); ?>
				</td>
    </tr>
    <tr>
        <td class='l-style no-border no-background'>
            (<span class='red-star'>*</span>) <?php echo __('Required') ?>
        </td>
        <td class='r-style actions no-border no-background'>
            <?php echo __($this->Form->submit(__('Save'), array('id' => 'submit_post'))); ?>
        </td>
    </tr>
</table>
<?php echo $this->Form->end(); ?>

<script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery('#PostAdminAddForm').validate();
				jQuery('#PostTags').tagsInput();
    });
</script>
